#!/bin/bash

# 获取CPU信息
cpu_info=$(cat /proc/cpuinfo | grep -m 1 "model name" | awk -F ":" '{print $2}' | sed 's/^ *//')

# 获取内存信息
mem_info=$(free -h | awk '/Mem:/ {print $2}')

# 获取磁盘空间信息
disk_info=$(df -h | awk '$NF=="/" {printf "Disk Usage: %s/%s (%s)\n", $3, $2, $5}')

#获取cpu核数
cpu_num=$(cat /proc/cpuinfo | grep "processor" | wc -l)

#获取总内存
mem_total=$(free -h | awk 'NR==2{print $2}')

#获取磁盘大小
disk_num=$(lsblk -o NAME,SIZE,TYPE,MOUNTPOINT | grep disk)
disk_total=$(lsblk -o NAME,SIZE,TYPE,MOUNTPOINT | grep disk | awk '{sum += $2} END {print sum}')

# 输出信息
echo "CPU: $cpu_info"
echo "Memory: $mem_info"
echo "Disk: $disk_info"

 
